package com.itheima.mybatis.framework;

import org.springframework.beans.factory.FactoryBean;

/**
 * @author ：sean
 * @date ：Created in 2020/7/1
 * @description ：
 * @version: 1.0
 */
public class HmMapperFactoryBean implements FactoryBean {
	private  Class mapperInterface;

	public void setMapperInterface(Class mapperInterface) {
		this.mapperInterface = mapperInterface;
	}

	@Override
	public Class<?> getObjectType() {
		return mapperInterface;
	}

	@Override
	public boolean isSingleton() {
		return false;
	}

	@Override
	public Object getObject() throws Exception {
		System.out.println("mapperInterface:"+mapperInterface);
		Object mapper = new DefaultHmSqlSession().getMapper(mapperInterface);
		return mapper;
	}
}
